package com.forte.productdao;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import com.forte.cartdao.CartProduct;
import com.forte.categorydao.Category;

@Entity(name="products")
public class Product implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Id
	@Column
	private int productId;
	
	@Column
	private String productName;
	
	@Column
	private String productSlugName;
	
	@Column
	private String description;
	
	@Column
	private int quantityInStock;
	
	@Column
	private double price;
	
	@Column
	private int categoryId;
	
	@Column
	private String imageUrl;
	
	@OneToMany(cascade = CascadeType.ALL)
	private Set<CartProduct> cartProduct = new HashSet<CartProduct>();
	
	@ManyToOne
	@JoinColumn(name="categoryId", insertable=false, updatable=false)
	private Category category;

	public int getProductId() {
		return productId;
	}

	public void setProductId(int productId) {
		this.productId = productId;
	}

	public String getProductName() {
		return productName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}

	public String getProductSlugName() {
		return productSlugName;
	}

	public void setProductSlugName(String productSlugName) {
		this.productSlugName = productSlugName;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public int getQuantityInStock() {
		return quantityInStock;
	}

	public void setQuantityInStock(int quantityInStock) {
		this.quantityInStock = quantityInStock;
	}

	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public int getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(int categoryId) {
		this.categoryId = categoryId;
	}

	public String getImageUrl() {
		return imageUrl;
	}

	public void setImageUrl(String imageUrl) {
		this.imageUrl = imageUrl;
	}

}
